ConfigADExam

Notification before use

Depending on the type of product you are using, the definitions of ‘Parameter’, ‘IO Logic’, ‘AxisStatus’, etc. may be different. This example is based on ‘Ezi-SERVO2’, so please apply the appropriate value depending on the product you are using.

Example)

FM_EZISERVO2_PARAM          // Parameter enum when using 'Ezi-SERVO2'
FM_EZIMOTIONLINK2_PARAM     // Parameter enum when using 'Ezi-MOTIONLINK2'

0. Program scenario

[EN]
1. Connect a device. 2. Configure AD parameters. 3. Read AD parameters. 4. Close connection.

[KR]
1. 장치 연결. 2. AD 파라미터 설정. 3. AD 파라미터 읽기. 4. 연결 해제.

1. Set AD Parameter

unsigned char byChannel = 0;            //Channel = 0
int lADRange = 0;           //AD Range = 0
int lFilterLen = 1000;      //Filter Length = 1000
int lFilterOffset = -1000;  //Filter Offset = -1000
int lRecv = 0;

printf("---------------------------------- \n");
// Set AD Range to 0 (-10 ~ 10[V])
if (FAS_SetADConfig(nBdID, byChannel, TYPE_AD_RANGE, lADRange, &lRecv) != FMM_OK)
{
    printf("Function(FAS_SetADConfig) was failed.\n");
}

// Set Filter Length to 1000
if (FAS_SetADConfig(nBdID, byChannel, TYPE_AD_FILTER_LENGTH, lFilterLen, &lRecv) != FMM_OK)
{
    printf("Function(FAS_SetADConfig) was failed.\n");
}

// Set Filter Offset to -1000
if (FAS_SetADConfig(nBdID, byChannel, TYPE_AD_FILTER_OFFSET, lFilterOffset, &lRecv) != FMM_OK)
{
    printf("Function(FAS_SetADConfig) was failed.\n");
}

[EN]
You can change AD configurations using the FAS_SetADConfig() function. Meaning of each argument is as follows sequentially: ‘ID number of the board’, ‘channel number’, ‘parameter type’, ‘parameter value’, ‘pointer where the value applied to the parameter will be returned’

[KR]
FAS_SetADConfig() 함수를 사용하여 AD 관련 설정을 변경할 수 있습니다. 해당 함수의 각 인자는 순차적으로 다음을 의미합니다. ‘해당 보드의 ID번호’, ‘채널 번호’, ‘파라미터 타입’, ‘파라미터 값’, ‘파라미터에 적용된 값이 반환될 포인터’

1.1 AD_DATA_TYPE

[EN]
AD_DATA_TYPE is an enum data type declared to identify AD parameters. Meaning of each data type is as follows:

TYPE_AD_RANGE : Analog Input Range TYPE_AD_FILTER_LENGTH : Filter Length TYPE_AD_FILTER_OFFSET : AD Conversion Offset

You can check AD_DATA_TYPE in the header file (MOTION_DEFINE.h).

[KR]
AD_DATA_TYPE은 AD 파라미터를 식별하기 위해 선언된 enum 자료형입니다. 각 Type은 다음을 의미합니다.

TYPE_AD_RANGE: 아날로그 입력 범위 TYPE_AD_FILTER_LENGTH: Filter 길이 TYPE_AD_FILTER_OFFSET: AD 변환 Offset

AD_DATA_TYPE은 헤더파일 (MOTION_DEFINE.h)에서 확인하실 수 있습니다.

2. Read AD parameter

unsigned char byChannel = 0; //Channel 0
int lRecv = 0;

printf("---------------------------------- \n");
// Get AD Range
if (FAS_GetADConfig(nBdID, byChannel, TYPE_AD_RANGE, &lRecv) != FMM_OK)
{
    printf("Function(FAS_GetADConfig) was failed.\n");
}

// Get Filter Length
if (FAS_GetADConfig(nBdID, byChannel, TYPE_AD_FILTER_LENGTH, &lRecv) != FMM_OK)
{
    printf("Function(FAS_GetADConfig) was failed.\n");
}

// Get Filter Offset
if (FAS_GetADConfig(nBdID, byChannel, TYPE_AD_FILTER_OFFSET, &lRecv) != FMM_OK)
{
    printf("Function(FAS_GetADConfig) was failed.\n");
}

[EN]
You can read AD configurations using the FAS_GetADConfig() function. Meaning of each argument is as follows sequentially: ‘ID number of the board’, ‘channel number’, ‘parameter type’, ‘variable pointer to store the parameter’

[KR]
FAS_GetADConfig() 함수를 사용하여 AD 관련 설정를 읽어올 수 있습니다. 해당 함수의 각 인자는 순차적으로 다음을 의미합니다. ‘해당 보드의 ID번호’, ‘채널 번호’, ‘파라미터 타입’, ‘파라미터를 저장할 변수 포인터’

3. Etc

[EN]
1. Please refer to the [01.ConnectionExam] project document for function descriptions on connecting and disconnecting devices.

[KR]
1. 장치 연결 및 해제에 대한 함수 설명은 [01.ConnectionExam] 프로젝트 문서를 참고하시기 바랍니다.